package com.caipos.actor.device;

import com.caipos.actor.ActorSystemContext;
import com.caipos.actor.common.actors.KbActorCtx;
import com.caipos.actor.common.data.id.DeviceId;
import com.caipos.actor.common.data.id.TenantId;
import com.caipos.actor.common.msg.KbMsgMetaData;
import com.caipos.actor.shared.AbstractContextAwareMsgProcessor;
import lombok.extern.slf4j.Slf4j;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ScheduledFuture;


@Slf4j
public class DeviceActorMessageProcessor extends AbstractContextAwareMsgProcessor {

    static final String SESSION_TIMEOUT_MESSAGE = "session timeout!";
    final TenantId tenantId;
    final DeviceId deviceId;
    private final boolean closeTransportSessionOnRpcDeliveryTimeout;

    private int rpcSeq = 0;
    private String deviceName;
    private String deviceType;
    private KbMsgMetaData defaultMetaData;
    private ScheduledFuture<?> awaitRpcResponseFuture;

    DeviceActorMessageProcessor(ActorSystemContext systemContext, TenantId tenantId, DeviceId deviceId) {
        super(systemContext);
        this.tenantId = tenantId;
        this.deviceId = deviceId;
        this.closeTransportSessionOnRpcDeliveryTimeout = systemContext.isCloseTransportSessionOnRpcDeliveryTimeout();
    }

    private Set<String> toSet(List<String> strings) {
        return new HashSet<>(strings);
    }


    void init(KbActorCtx ctx) {

    }

    void checkSessionsTimeout() {
    }

}
